import {CFormGroupProps} from "@/components/CProForm/CFormItem/type";
import {QuestionCircleTwoTone} from "@ant-design/icons";
import color from "@/utils/color";

// @ts-ignore
const fields: CFormGroupProps<any>[] = (button: boolean) => {
  if (!button) {
    return [
      {
        itemList: [
          {
            name: "menuName",
            label: "菜单名称",
            labelAlign: "right",
            rules: [
              {
                message: "菜单名称是必填项",
                required: true
              }
            ],
            width: "md",
            placeholder: "请输入菜单名称",
          },
          {
            name: "icon",
            label: "菜单图标",
            labelAlign: "right",
            // rules: [
            //   {
            //     message: "菜单图标是必填项",
            //     required: true
            //   }
            // ],
            width: "md",
            tooltip: {
              title: "此功能还未实现",
              icon: <QuestionCircleTwoTone/>
            },
            placeholder: "请输入菜单图标",
          },
          {
            name: "componentPath",
            label: "前端组件地址",
            labelAlign: "right",
            // rules: [
            //   {
            //     message: "前端组件地址是必填项",
            //     required: true
            //   }
            // ],
            width: "md",
            placeholder: "请输入前端组件地址",
          },
          {
            name: "route",
            label: "组件路由",
            labelAlign: "right",
            rules: [
              {
                message: "组件路由是必填项",
                required: true
              }
            ],
            width: "md",
            placeholder: "请输入组件路由",
          },
          {
            name: "authorize",
            label: "需要的权限",
            labelAlign: "right",
            rules: [
              {
                message: "需要的权限是必填项",
                required: true
              }
            ],
            width: "md",
            placeholder: "请输入需要的权限",
          },
          {
            name: "sort",
            label: "菜单排序",
            labelAlign: "right",
            rules: [
              {
                message: "菜单排序是必填项",
                required: true
              }
            ],
            width: "md",
            placeholder: "请输入菜单排序",
          },
        ]
      },
    ]
  } else {
    return [
      {
        itemList: [
          {
            name: "menuName",
            label: "按钮名称",
            labelAlign: "right",
            rules: [
              {
                message: "菜单名称是必填项",
                required: true
              }
            ],
            width: "md",
            placeholder: "请输入菜单名称",
          },
          {
            name: "authorize",
            label: "需要的权限",
            labelAlign: "right",
            rules: [
              {
                message: "需要的权限是必填项",
                required: true
              }
            ],
            width: "md",
            placeholder: "请输入需要的权限",
          },
        ]
      },
      {
        itemList: [
          {
            name: "color",
            label: "颜色",
            labelAlign: "right",
            type: "select",
            width: 200,
            rules: [
              {
                message: "值是必填项",
                required: true
              }
            ],
            options: color,
          },
        ]
      }
    ]
  }
  return [
    {
      itemList: [
        {
          name: "menuName",
          label: "菜单名称",
          labelAlign: "right",
          rules: [
            {
              message: "菜单名称是必填项",
              required: true
            }
          ],
          width: "md",
          placeholder: "请输入菜单名称",
        },
        {
          name: "icon",
          label: "菜单图标",
          labelAlign: "right",
          // rules: [
          //   {
          //     message: "菜单图标是必填项",
          //     required: true
          //   }
          // ],
          width: "md",
          tooltip: {
            title: "此功能还未实现",
            icon: <QuestionCircleTwoTone/>
          },
          placeholder: "请输入菜单图标",
        },
        {
          name: "componentPath",
          label: "前端组件地址",
          labelAlign: "right",
          // rules: [
          //   {
          //     message: "前端组件地址是必填项",
          //     required: true
          //   }
          // ],
          width: "md",
          placeholder: "请输入前端组件地址",
        },
        {
          name: "route",
          label: "组件路由",
          labelAlign: "right",
          rules: [
            {
              message: "组件路由是必填项",
              required: true
            }
          ],
          width: "md",
          placeholder: "请输入组件路由",
        },
        {
          name: "authorize",
          label: "需要的权限",
          labelAlign: "right",
          rules: [
            {
              message: "需要的权限是必填项",
              required: true
            }
          ],
          width: "md",
          placeholder: "请输入需要的权限",
        },
        {
          name: "sort",
          label: "菜单排序",
          labelAlign: "right",
          rules: [
            {
              message: "菜单排序是必填项",
              required: true
            }
          ],
          width: "md",
          placeholder: "请输入菜单排序",
        },
      ]
    },
  ]
}
export default fields;

